package com.tool_stdy;

import java.util.HashMap;
import java.util.List;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.google.common.collect.Lists;

public class Test {

  public static void test(){
//       HashMap<String,String> parames = new HashMap<String, String>();
//       parames.put("name", "ab");
//       parames.put("adr", "aa");
//       
//       HashMap<String,String> parames2 = new HashMap<String, String>();
//       parames2.put("name", "ab");
//       parames2.put("adr", "aa");
   List<HashMap<String,String>> liMap =Lists.newArrayList();
//       liMap.add(parames);
//       liMap.add(parames2);
//       System.out.println(JSON.toJSONString(liMap));
    String src="[{\"adr\":\"aa\",\"name\":\"ab\"},{\"adr\":\"aa\",\"name\":\"ab\"}]";
    List<HashMap> li = JSON.parseObject(src, new TypeReference<List<HashMap>>(){});
       for(HashMap<String,String> obj:li){
//           Map<String,String> maps  =(Map<String,String>)obj;
           System.out.println(obj.get("adr"));
       }
    }
    
    
    public static void main(String[] args) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {
//        String src="16708167357442:preview:{totalCount:22;average:1.57} search:{totalCount:3;average:0.21}";
//        
//       if(src.contains("preview")){
//           String preview = src.split("preview")[1];
//           preview=(String) preview.subSequence(preview.indexOf("{"), preview.indexOf("}")+1);
//           preview=(String)preview.substring(preview.indexOf(":")+1, preview.indexOf(";"));
//           System.out.println(preview);
//       }
//        String src="preview_32;search_12;";
//        System.out.println(src.split(";")[0]);
//        Integer a  = new Integer(3);
//        Integer b = 3;
//        System.out.println(a==3);
        test();
    }
}
